package com.encryption.feature.doc
{
	import com.encryption.feature.user.GlobalUser;
	import com.encryption.rpc.RPCEvent;
	import com.encryption.rpc.facade.FileLogFacade;
	import com.encryption.rpc.model.FileLog;

	public class FileLogManager
	{
		private static var _instance:FileLogManager = new FileLogManager();
		
		public function FileLogManager()
		{
		}
		
		public static function get instance():FileLogManager
		{
			return _instance;	
		}
		
		public function addLog(file:int, fileAction:int):void
		{
			var log:FileLog = createFileLog(file, fileAction);
			new FileLogFacade(FileLogFacade.OPERATION_addLog, {arg0:log}, addLogHandle);
		}
		
		private function addLogHandle(event:RPCEvent):void
		{
			
		}
		
		private function createFileLog(file:int, fileAction:int):FileLog{
			var fileLog:FileLog = new FileLog();
			var user:int = GlobalUser.currentUser.id;
			fileLog.user = user;
			fileLog.file = file;
			fileLog.fileAction = fileAction;
			fileLog.time = new Date();
			
			return fileLog;
		}
	}
}